{{- $enable := and (default true .Params.toc) (default true .Site.Params.toc) -}}
{{- $wordCount := default 280 .Site.Params.tocWordCount -}}
{{- $toc := .TableOfContents -}}
{{- $valid := and $toc (and (ne $toc "<nav id=\"TableOfContents\"></nav>") (gt .WordCount $wordCount)) -}}
{{- if and $enable $valid -}}
<a class="action" data-bs-toggle="offcanvas" href="#offcanvasTOC" aria-controls="offcanvasTOC" role="button">
  <i class="fas fa-fw fa-list-alt"></i>
</a>
{{- end -}}
